//
//  TableController.h
//  TianyaGuest
//
//  Created by liuwenyang on 14-8-19.
//  Copyright (c) 2014年 liuwenyang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "LBEasyTableViewCell.h"
#import <LBEmptyData/UIView+LBEmptyData.h>

@class LBEasyTableController;

@protocol LBEasyTableControllerDelegate <NSObject>

@optional
- (void)modelDidLoadFinished:(LBEasyTableController *)controller;
- (void)didSelectedCell:(LBEasyTableController *)controller dataSrc:(id)dataSrc row:(NSInteger)row;
- (void)didClickCellSubView:(LBEasyTableController *)tableController subView:(id)subView subViewData:(id)subViewData;
- (void)beforeSetDataWithModel:(id)model cell:(LBEasyTableViewCell *)cell indexPath:(NSIndexPath *)indexPath tableController:(LBEasyTableController *)tableController;
@end

@interface LBEasyTableController : NSObject <UITableViewDataSource, UITableViewDelegate, LBEasyTableViewCellDelegate>
@property (nonatomic, weak) id<LBEasyTableControllerDelegate> delegate;
@property (nonatomic, strong) UITableView* tableView;
@property (nonatomic, assign) NSInteger listTotal;
@property (nonatomic, strong) NSMutableArray *listArray;
@property (nonatomic, assign) Class classForCell;
/** 是否使用ios8的自动算高*/
@property(nonatomic,assign)BOOL isAutoCalculateHeight;

/** 预估高度,使用自动算高必须设置,默认50*/
@property(nonatomic,assign)CGFloat estimatedRowHeight;

//初始化
- (id)initWithClassForCell:(Class)classForCell;
-(UITableViewStyle)tableViewStyle;

+(NSString *)nodataTipsString;

-(BOOL)setCustomEmptyView;

+(CGFloat)leftMargins;
+(CGFloat)rightMargins;

@end


//加了刷新机制的tablecontroller
@interface LBEasyRefreshTableController : LBEasyTableController


@property (nonatomic, assign) NSInteger totalCount;

/** 注释*/
@property(nonatomic,assign)NSInteger totalPages;

@property (nonatomic, assign) NSInteger pageIndex;


- (id)initWithDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll classForCell:(Class)classForCell;

//需要子类重载
- (void)refreshTable:(void (^)(BOOL finished))block;
- (void)getTableMore:(void (^)(BOOL finished))block;

//强制模拟下拉刷新
- (void)forceRefresh;

//强制刷新不带下拉效果
-(void)forceRefreshWithoutAnimation;



- (void)refreshHeaderViewDidCallBackWithAnimation:(BOOL)animation;

@end















